// 全局变量
// 颜色
$colors: (
    "purple":#83a2ed,
    "purple-1":#83a2ed,
    "black":#e5e5e5,
    "blue":#6ac6e2,
    "blue-1":#82d7f2,
    "blue-2":#5fd9de,
    "blue-3":#83e4f3,
    "green":#58d88e,
    "green-1":#58d8ab,
);

// 字体大小
$base-font-size: 1px;
$font-sizes: (
    xxs: 14,
    xs: 14,
    sm: 14,
    md: 14,
    lg: 14,
    xl: 14,
    xxl: 50
);

// 宽高
.w-100 {
    width: 100%;
}
.h-100 {
    height: 100%;
}

//  全局样式
.clearfix {
    &::after {
        content: "";
        display: table;
        height: 0;
        line-height: 0;
        visibility: hidden;
        clear: both;
    }
}

//浮动
.float-r {
    float: right;
}

//浮动
.float-l {
    float: left;
}

// 字体加粗
.fw-b {
    font-weight: bold;
}

//文章一行显示，多余省略号显示
.title-item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

//flex
.d-flex {
    display: flex;
}
.flex-column {
    flex-direction: column;
}
.flex-wrap {
    flex-wrap: wrap;
}
.flex-nowrap {
    flex-wrap: nowrap;
}
$flex-jc: (
    start: flex-start,
    end: flex-end,
    center: center,
    between: space-between,
    around: space-around,
    evenly: space-evenly,
);

$flex-ai: (
    start: flex-start,
    end: flex-end,
    center: center,
    stretch: stretch,
);
.flex-1 {
    flex: 1;
}

//.mt-1 => margin top
//spacing
$spacing-types: (
    m: margin,
    p: padding,
);
$spacing-directions: (
    t: top,
    r: right,
    b: bottom,
    l: left,
);
$spacing-base-size: 1px;
$spacing-sizes: (
    0: 0,
    5: 5,
    10: 10,
    20:20,
    30:30
);

//颜色
@each $colorkey, $color in $colors {
    .text-#{$colorkey} {
        color: $color;
    }

    .bg-#{$colorkey} {
        background-color: $color;
    }
}

//对齐
@each $var in (left, center, right) {
    .text-#{$var} {
        text-align: $var !important;
    }
}

//flex
@each $key, $value in $flex-jc {
    .jc-#{$key} {
        justify-content: $value;
    }
}
@each $key, $value in $flex-ai {
    .ai-#{$key} {
        align-items: $value;
    }
}

//字体
@each $fontkey, $fontvalue in $font-sizes {
    .fs-#{$fontkey} {
        font-size: $fontvalue * $base-font-size;
    }
}

//.mt-1 => margin top
//spacing
@each $typekey, $type in $spacing-types {
    //.m-1
    @each $sizekey, $size in $spacing-sizes {
        .#{$typekey}-#{$sizekey} {
            #{$type}: $size * $spacing-base-size;
        }
    }

    //.mx-1
    @each $sizekey, $size in $spacing-sizes {
        .#{$typekey}x-#{$sizekey} {
            #{$type}-left: $size * $spacing-base-size;
            #{$type}-right: $size * $spacing-base-size;
        }

        .#{$typekey}y-#{$sizekey} {
            #{$type}-top: $size * $spacing-base-size;
            #{$type}-bottom: $size * $spacing-base-size;
        }
    }

    //.mt-1
    @each $directionkey, $direction in $spacing-directions {
        @each $sizekey, $size in $spacing-sizes {
            .#{$typekey}#{$directionkey}-#{$sizekey} {
                #{$type}-#{$direction}: $size * $spacing-base-size;
            }
        }
    }

    .#{$typekey} {
        #{$type}: 0;
    }
}
